<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 用于：当两个请求的结果都成功，才可以进行下一步操作的情况
        Promise.all([
            new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve({ name: 'cgs', age: 18 })
                }, 1000)

            }),
            new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve({ name: 'thtm', age: 19 })
                }, 2000)
            })
        ]).then((results) => {
            console.log(results);
        })
    </script>
</body>

</html>